/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author kenny
 */
@Entity
@Table(name = "persona")
@NamedQueries({
    @NamedQuery(name = "Persona.findAll", query = "SELECT p FROM Persona p"),
    @NamedQuery(name = "Persona.findByNPrsId", query = "SELECT p FROM Persona p WHERE p.nPrsId = :nPrsId"),
    @NamedQuery(name = "Persona.findByVNombre", query = "SELECT p FROM Persona p WHERE p.vNombre = :vNombre"),
    @NamedQuery(name = "Persona.findByVApellidos", query = "SELECT p FROM Persona p WHERE p.vApellidos = :vApellidos"),
    @NamedQuery(name = "Persona.findByVLogin", query = "SELECT p FROM Persona p WHERE p.vLogin = :vLogin"),
    @NamedQuery(name = "Persona.findByVPassword", query = "SELECT p FROM Persona p WHERE p.vPassword = :vPassword"),
    @NamedQuery(name = "Persona.findByVEmail", query = "SELECT p FROM Persona p WHERE p.vEmail = :vEmail"),
    @NamedQuery(name = "Persona.findByVGenero", query = "SELECT p FROM Persona p WHERE p.vGenero = :vGenero"),
    @NamedQuery(name = "Persona.findByVEstado", query = "SELECT p FROM Persona p WHERE p.vEstado = :vEstado"),
    @NamedQuery(name = "Persona.buscarMaxId", query = "SELECT MAX(p.nPrsId) FROM Persona p")})
public class Persona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "nPrsId")
    private Integer nPrsId;
    @Size(max = 60)
    @Column(name = "vNombre")
    private String vNombre;
    @Size(max = 60)
    @Column(name = "vApellidos")
    private String vApellidos;
    @Size(max = 60)
    @Column(name = "vLogin")
    private String vLogin;
    @Size(max = 60)
    @Column(name = "vPassword")
    private String vPassword;
    @Size(max = 60)
    @Column(name = "vEmail")
    private String vEmail;
    @Size(max = 1)
    @Column(name = "vGenero")
    private String vGenero;
    @Size(max = 1)
    @Column(name = "vEstado")
    private String vEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nPrsId")
    private List<Alumno> alumnoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nPrsId")
    private List<Docente> docenteList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "persona")
    private List<Personaxperfil> personaxperfilList;

    public Persona() {
    }

    public Persona(Integer nPrsId) {
        this.nPrsId = nPrsId;
    }

    public Integer getNPrsId() {
        return nPrsId;
    }

    public void setNPrsId(Integer nPrsId) {
        this.nPrsId = nPrsId;
    }

    public String getVNombre() {
        return vNombre;
    }

    public void setVNombre(String vNombre) {
        this.vNombre = vNombre;
    }

    public String getVApellidos() {
        return vApellidos;
    }

    public void setVApellidos(String vApellidos) {
        this.vApellidos = vApellidos;
    }

    public String getVLogin() {
        return vLogin;
    }

    public void setVLogin(String vLogin) {
        this.vLogin = vLogin;
    }

    public String getVPassword() {
        return vPassword;
    }

    public void setVPassword(String vPassword) {
        this.vPassword = vPassword;
    }

    public String getVEmail() {
        return vEmail;
    }

    public void setVEmail(String vEmail) {
        this.vEmail = vEmail;
    }

    public String getVGenero() {
        return vGenero;
    }

    public void setVGenero(String vGenero) {
        this.vGenero = vGenero;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public List<Alumno> getAlumnoList() {
        return alumnoList;
    }

    public void setAlumnoList(List<Alumno> alumnoList) {
        this.alumnoList = alumnoList;
    }

    public List<Docente> getDocenteList() {
        return docenteList;
    }

    public void setDocenteList(List<Docente> docenteList) {
        this.docenteList = docenteList;
    }

    public List<Personaxperfil> getPersonaxperfilList() {
        return personaxperfilList;
    }

    public void setPersonaxperfilList(List<Personaxperfil> personaxperfilList) {
        this.personaxperfilList = personaxperfilList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nPrsId != null ? nPrsId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Persona)) {
            return false;
        }
        Persona other = (Persona) object;
        if ((this.nPrsId == null && other.nPrsId != null) || (this.nPrsId != null && !this.nPrsId.equals(other.nPrsId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Persona[ nPrsId=" + nPrsId + " ]";
    }
    
}
